home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / tcl / extend / src / tclExtdInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-31  |  13.0 KB  |  540 lines  |  [TEXT/MPS ]

  1. /*
  2.  * tclExtdInt.h
  3.  *
  4.  * Standard internal include file for Extended Tcl library..
  5.  *-----------------------------------------------------------------------------
  6.  * Copyright 1991-1993 Karl Lehenbauer and Mark Diekhans.
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted, provided
  10.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11.  * Mark Diekhans make no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without express or
  13.  * implied warranty.
  14.  *-----------------------------------------------------------------------------
  15.  * $Id: tclExtdInt.h,v 2.23 1993/08/31 23:03:20 markd Exp $
  16.  *-----------------------------------------------------------------------------
  17.  */
  18.  
  19. #ifndef TCLEXTDINT_H
  20. #define TCLEXTDINT_H
  21.  
  22. #include "tclExtend.h"
  23. #include "tclXconfig.h"
  24. #include "tclInt.h"
  25. #include "tclUnix.h"
  26.  
  27. #ifndef macintosh
  28. #include <sys/param.h>
  29. #endif
  30.  
  31. /*
  32.  * If tclUnix.h has already included time.h, don't include it again, some
  33.  * systems don't #ifdef inside of the file.
  34.  */
  35. #ifdef TIME_WITH_SYS_TIME
  36. #    include <sys/time.h>
  37. #    include <time.h>
  38. #else
  39. #    ifdef NO_SYS_TIME_H
  40. #        include <time.h>
  41. #    else
  42. #        include <sys/time.h>
  43. #    endif
  44. #endif
  45.  
  46. #ifndef macintosh
  47. #include <sys/times.h>
  48. #endif
  49.  
  50. /*
  51.  * Precompute milliseconds-per-tick, the " + CLK_TCK / 2" bit gets it to
  52.  * round off instead of truncate.  Take care of defining CLK_TCK if its not
  53.  * defined.
  54.  */
  55. #ifndef CLK_TCK
  56. #    ifdef HZ
  57. #        define CLK_TCK HZ
  58. #    else
  59. #        define CLK_TCK 60
  60. #    endif
  61. #endif
  62.  
  63. #ifdef macintosh
  64. #define MS_PER_TICK    ( 1000 / 60 )
  65. #else
  66. #define MS_PER_TICK ((1000 + CLK_TCK/2) / CLK_TCK)
  67. #endif
  68.  
  69. #ifdef NO_VALUES_H
  70. #    include <math.h>
  71. #    include <limits.h>
  72. #else
  73. #    include <values.h>
  74. #endif
  75.  
  76. #ifndef MAXDOUBLE
  77. #    define MAXDOUBLE HUGE_VAL
  78. #endif
  79.  
  80. #ifndef macintosh
  81. #include <grp.h>
  82. #endif
  83.  
  84.  
  85. /*
  86.  * These should be take from an include file, but it got to be such a mess
  87.  * to get the include files right that they are here for good measure.
  88.  */
  89. struct tm *gmtime ();
  90. struct tm *localtime ();
  91.  
  92. /*
  93.  * Determine how a timezone is obtained from "struct tm".  If there is no
  94.  * time zone in this struct (very lame) then use the timezone variable.
  95.  * This is done in a way to make the timezone variable the method of
  96.  * second to last resort, as some systems have it in addition to a field in
  97.  * "struct tm".  The last resort is to use gettimeofday to determine the
  98.  * time zone (this is all a big drag).
  99.  */
  100.  
  101. #if defined(HAVE_TM_TZADJ)
  102. #    define TCL_USE_TM_TZADJ
  103. #    define TCL_GOT_TIMEZONE
  104. #endif
  105. #if defined(HAVE_TM_GMTOFF) && !defined (TCL_GOT_TIMEZONE)
  106. #    define TCL_USE_TM_GMTOFF
  107. #    define TCL_GOT_TIMEZONE
  108. #endif
  109. #if defined(HAVE_TIMEZONE_VAR) && !defined (TCL_GOT_TIMEZONE)
  110. #    define TCL_USE_TIMEZONE_VAR
  111. #    define TCL_GOT_TIMEZONE
  112. #endif
  113. #if defined(HAVE_GETTIMEOFDAY) && !defined (TCL_GOT_TIMEZONE)
  114. #    define TCL_USE_GETTIMEOFDAY
  115. #    define TCL_GOT_TIMEZONE
  116. #endif
  117.  
  118.  
  119. #ifndef MAXINT
  120. #    define BITSPERBYTE   8
  121. #    define BITS(type)    (BITSPERBYTE * (int)sizeof(type))
  122. #    define HIBITI        (1 << BITS(int) - 1)
  123. #    define MAXINT        (~HIBITI)
  124. #endif
  125.  
  126. #ifndef MININT
  127. #    define MININT (-MAXINT)-1
  128. #endif
  129.  
  130. /*
  131.  * If no MAXLONG, assume sizeof (long) == sizeof (int).
  132.  */
  133. #ifndef MAXLONG
  134. #    define MAXLONG MAXINT  
  135. #endif
  136.  
  137. #ifndef TRUE
  138. #    define TRUE   (1)
  139. #    define FALSE  (0)
  140. #endif
  141.  
  142. /*
  143.  * Structure to hold a regular expression, plus a Boyer-Moore compiled
  144.  * pattern.  Also structure to return submatch info.
  145.  */
  146.  
  147. typedef struct {
  148.     regexp *progPtr;
  149.     char   *boyerMoorePtr;
  150.     int     noCase;
  151. } Tcl_regexp;
  152.  
  153. typedef struct {
  154.     int start;
  155.     int end;
  156. } Tcl_SubMatchInfo [NSUBEXP];
  157.  
  158. /*
  159.  * Flags used by Tcl_RegExpCompile:
  160.  */
  161. #define REXP_NO_CASE         1   /* Do matching regardless of case    */
  162. #define REXP_BOTH_ALGORITHMS 2   /* Use boyer-moore along with regexp */
  163.  
  164. /*
  165.  * Used to return argument messages by most commands.
  166.  */
  167. extern char *tclXWrongArgs;
  168.  
  169. /*
  170.  * Macros to do string compares.  They pre-check the first character before
  171.  * checking of the strings are equal.
  172.  */
  173.  
  174. #define STREQU(str1, str2) \
  175.         (((str1) [0] == (str2) [0]) && (strcmp (str1, str2) == 0))
  176. #define STRNEQU(str1, str2, cnt) \
  177.         (((str1) [0] == (str2) [0]) && (strncmp (str1, str2, cnt) == 0))
  178.  
  179. /*
  180.  * Macro to do ctype functions with 8 bit character sets.
  181.  */
  182. #define ISSPACE(c) (isspace ((unsigned char) c))
  183. #define ISDIGIT(c) (isdigit ((unsigned char) c))
  184. #define ISLOWER(c) (islower ((unsigned char) c))
  185.  
  186. /*
  187.  * Macro that behaves like strdup, only uses ckalloc.
  188.  */
  189. #define ckstrdup(sourceStr) \
  190.   (strcpy (ckalloc (strlen (sourceStr) + 1), sourceStr))
  191.  
  192.  
  193. /*
  194.  * Prototypes for utility procedures.
  195.  */
  196. extern void 
  197. Tcl_CommandLoop _ANSI_ARGS_((Tcl_Interp *interp,
  198.                              int         interactive));
  199.  
  200. extern int
  201. Tcl_DStringGets _ANSI_ARGS_((FILE         *filePtr,
  202.                              Tcl_DString  *dynStrPtr));
  203.  
  204. extern int
  205. Tcl_GetDate _ANSI_ARGS_((char   *p,
  206.                          time_t  now,
  207.                          long    zone,
  208.                          time_t *timePtr));
  209.  
  210. extern OpenFile *
  211. Tcl_GetOpenFileStruct _ANSI_ARGS_((Tcl_Interp *interp,
  212.                                    char       *handle));
  213.  
  214. extern void
  215. Tcl_OutputPrompt _ANSI_ARGS_((Tcl_Interp *interp,
  216.                               int         topLevel));
  217.  
  218. extern void
  219. Tcl_PrintResult _ANSI_ARGS_((Tcl_Interp *interp,
  220.                              int         intResult,
  221.                              char       *checkCmd));
  222.  
  223. extern int
  224. Tcl_ProcessSignal _ANSI_ARGS_((ClientData  clientData,
  225.                                Tcl_Interp *interp,
  226.                                int         cmdResultCode));
  227.  
  228. extern void
  229. Tcl_RegExpClean _ANSI_ARGS_((Tcl_regexp *regExpPtr));
  230.  
  231. extern int
  232. Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp  *interp,
  233.                                Tcl_regexp  *regExpPtr,
  234.                                char        *expression,
  235.                                int          flags));
  236.  
  237. extern int
  238. Tcl_RegExpExecute _ANSI_ARGS_((Tcl_Interp       *interp,
  239.                                Tcl_regexp       *regExpPtr,
  240.                                char             *matchStrIn,
  241.                                char             *matchStrLower,
  242.                                Tcl_SubMatchInfo  subMatchInfo));
  243.  
  244. extern int
  245. Tcl_RelativeExpr _ANSI_ARGS_((Tcl_Interp  *interp,
  246.                               char        *cstringExpr,
  247.                               long         stringLen,
  248.                               long        *exprResultPtr));
  249.  
  250. extern void
  251. Tcl_ResetSignals ();
  252.  
  253. void
  254. Tcl_SetLibraryDirEnvVar _ANSI_ARGS_((Tcl_Interp  *interp,
  255.                                      char        *envVar,
  256.                                      char        *dir,
  257.                                      char        *version1,
  258.                                      char        *version2));
  259.  
  260. extern FILE *
  261. Tcl_SetupFileEntry _ANSI_ARGS_((Tcl_Interp *interp,
  262.                                 int         fileNum,
  263.                                 int         permissions));
  264.  
  265. extern void
  266. Tcl_CloseForError _ANSI_ARGS_((Tcl_Interp *interp,
  267.                                int         fileNum));
  268.  
  269. extern void
  270. Tcl_SetupSigInt _ANSI_ARGS_(());
  271.  
  272. /*
  273.  * Definitions required to initialize all extended commands.  These are either
  274.  * the command executors or initialization routines that do the command
  275.  * initialization.  The initialization routines are used when there is more
  276.  * to initializing the command that just binding the command name to the
  277.  * executor.  Usually, this means initializing some command local data via
  278.  * the ClientData mechanism.  The command executors should be declared to be of
  279.  * type `Tcl_CmdProc', but this blows up some compilers, so they are declared
  280.  * with an ANSI prototype.
  281.  */
  282.  
  283. /*
  284.  * from tclXbsearch.c
  285.  */
  286. extern int 
  287. Tcl_BsearchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  288.  
  289. /*
  290.  * from tclXchmod.c
  291.  */
  292. extern int 
  293. Tcl_ChmodCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  294.  
  295. extern int 
  296. Tcl_ChownCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  297.  
  298. extern int 
  299. Tcl_ChgrpCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  300.  
  301. /*
  302.  * from tclXclock.c
  303.  */
  304. extern int 
  305. Tcl_GetclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  306.  
  307. extern int 
  308. Tcl_FmtclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  309.  
  310. /*
  311.  * from tclXcnvclock.c
  312.  */
  313. extern int 
  314. Tcl_ConvertclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  315.  
  316. /*
  317.  * from tclXcmdloop.c
  318.  */
  319. extern int 
  320. Tcl_CommandloopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  321.  
  322. /*
  323.  * from tclXdebug.c
  324.  */
  325. extern void
  326. Tcl_InitDebug _ANSI_ARGS_((Tcl_Interp *interp));
  327.  
  328. /*
  329.  * from tclXdup.c
  330.  */
  331. extern int 
  332. Tcl_DupCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  333.  
  334. /*
  335.  * from tclXfcntl.c
  336.  */
  337. extern int 
  338. Tcl_FcntlCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  339.  
  340. /*
  341.  * from tclXfilecmds.c
  342.  */
  343. extern int 
  344. Tcl_PipeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  345.  
  346. extern int 
  347. Tcl_CopyfileCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  348.  
  349. extern int 
  350. Tcl_LgetsCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  351.  
  352. /*
  353.  * from tclXfstat.c
  354.  */
  355. extern int 
  356. Tcl_FstatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  357.  
  358. /*
  359.  * from tclXflock.c
  360.  */
  361. extern int
  362. Tcl_FlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  363.  
  364. extern int
  365. Tcl_FunlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  366.  
  367. /*
  368.  * from tclXfilescan.c
  369.  */
  370. extern void
  371. Tcl_InitFilescan _ANSI_ARGS_((Tcl_Interp *interp));
  372.  
  373. /*
  374.  * from tclXgeneral.c
  375.  */
  376.  
  377. extern int 
  378. Tcl_EchoCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  379.  
  380. extern int 
  381. Tcl_InfoxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  382.  
  383. extern int 
  384. Tcl_LoopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  385.  
  386. /*
  387.  * from tclXid.c
  388.  */
  389. extern int 
  390. Tcl_IdCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  391.  
  392. /*
  393.  * from tclXkeylist.c
  394.  */
  395. extern int 
  396. Tcl_KeyldelCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  397.  
  398. extern int 
  399. Tcl_KeylgetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  400.  
  401. extern int 
  402. Tcl_KeylkeysCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  403.  
  404. extern int 
  405. Tcl_KeylsetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  406.  
  407. /*
  408.  * from tclXlist.c
  409.  */
  410. extern int 
  411. Tcl_LvarpopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  412.  
  413. extern int 
  414. Tcl_LvarcatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  415.  
  416. extern int 
  417. Tcl_LvarpushCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  418.  
  419. extern int 
  420. Tcl_LemptyCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  421.  
  422. extern int 
  423. Tcl_LassignCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  424.  
  425. /*
  426.  * from tclXmath.c
  427.  */
  428. extern int 
  429. Tcl_MaxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  430.  
  431. extern int 
  432. Tcl_MinCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  433.  
  434. extern int 
  435. Tcl_RandomCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  436.  
  437. /*
  438.  * from tclXmsgcat.c
  439.  */
  440. extern void
  441. Tcl_InitMsgCat _ANSI_ARGS_((Tcl_Interp *interp));
  442.  
  443. /*
  444.  * from tclXprocess.c
  445.  */
  446. extern int 
  447. Tcl_ExeclCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  448.  
  449. extern int 
  450. Tcl_ForkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  451.  
  452. extern int 
  453. Tcl_WaitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  454.  
  455. /*
  456.  * from tclXprofile.c
  457.  */
  458. void
  459. Tcl_InitProfile _ANSI_ARGS_((Tcl_Interp *interp));
  460.  
  461. /*
  462.  * from tclXselect.c
  463.  */
  464. extern int 
  465. Tcl_SelectCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  466.  
  467. /*
  468.  * from tclXsignal.c
  469.  */
  470. extern void
  471. Tcl_InitSignalHandling _ANSI_ARGS_((Tcl_Interp *interp));
  472.  
  473. /*
  474.  * from tclXstring.c
  475.  */
  476. extern int 
  477. Tcl_CindexCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  478.  
  479. extern int 
  480. Tcl_ClengthCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  481.  
  482. extern int 
  483. Tcl_CrangeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  484.  
  485. extern int 
  486. Tcl_ReplicateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  487.  
  488. extern int 
  489. Tcl_TranslitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  490.  
  491. extern int 
  492. Tcl_CtypeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  493.  
  494. extern int 
  495. Tcl_CtokenCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  496.  
  497. /*
  498.  * from tclXlib.c
  499.  */
  500. extern void
  501. Tcl_InitLibrary _ANSI_ARGS_((Tcl_Interp *interp));
  502.  
  503. /*
  504.  * from tclXunixcmds.c
  505.  */
  506. extern int 
  507. Tcl_AlarmCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  508.  
  509. extern int 
  510. Tcl_SleepCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  511.  
  512. extern int 
  513. Tcl_SystemCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  514.  
  515. extern int 
  516. Tcl_TimesCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  517.  
  518. extern int 
  519. Tcl_UmaskCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  520.  
  521. extern int 
  522. Tcl_LinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  523.  
  524. extern int 
  525. Tcl_UnlinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  526.  
  527. extern int 
  528. Tcl_MkdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  529.  
  530. extern int 
  531. Tcl_RmdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  532.  
  533. /*
  534.  * from tclXserver.c
  535.  */
  536. extern int
  537. Tcl_ServerOpenCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  538.  
  539. #endif
  540.